#include "EnemyOrc.h"
#include "texturemanager.h"

bool EnemyOrc::m_first = true;
Texture* EnemyOrc::m_animate0 = nullptr;
Texture* EnemyOrc::m_animate1 = nullptr;

EnemyOrc::EnemyOrc() {
	if (m_first) {
		m_animate0 = TextureManager::Instance()->GetTexture("asset/orc/1.png");
		m_animate1 = TextureManager::Instance()->GetTexture("asset/orc/2.png");
		m_first = false;
	}
	SetTexture(m_animate0);
}

void EnemyOrc::Move(int x, int y) {
	int dx = x - m_x;
	int dy = y - m_y;
	m_x += dx > 0 ? m_speed : -m_speed;
	m_y += dy > 0 ? m_speed : -m_speed;
	m_pTexture = m_index % 2 ? m_animate0 : m_animate1;
	m_index++;
	m_index %= 2;
}
